#ifndef __DATA_PROCESS_H__
#define __DATA_PROCESS_H__


#ifdef __cplusplus
extern "C" {
#endif
#include "stdint.h"
#include "cmsis_os2.h"

typedef struct{
    uint16_t total_len;// 数据可用总长度
    uint16_t used_len;// 已使用长度
    uint8_t* p; // 数据指针
    uint8_t port;   // 数据来源端口号
    uint8_t status; // 1:一帧未完成 0:一帧已完成
    uint32_t timestamp;// 时间戳
}DataFrame;

extern osMessageQueueId_t dataSaveQueue;

void dataProcess_init();
uint8_t getDataArea(DataFrame* frame, uint8_t port);
void data_finish(DataFrame* frame,uint16_t used_len,uint8_t status);
void data_appendFinishFlag(uint8_t port);
void data_destroy(DataFrame* frame);
uint8_t frameStrOut(uint8_t port, uint32_t index, uint32_t nums,uint32_t* realNums,
                    uint8_t timeEnable, uint32_t waitTime,
                    void output_str(const char* str, uint16_t len));
#ifdef __cplusplus
}
#endif

#endif /* ! __DATA_PROCESS_H__ */


